import datetime
from applications.extensions import db


# 公众号文章
class Weixin_articles(db.Model):
    __tablename__ = 't_weixin_articles'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='文章ID')
    wx_name = db.Column(db.String(35), comment='公众号名称', nullable=False)
    wx_id = db.Column(db.String(35), comment='公众号微信号ID')
    wx_offac_id = db.Column(db.Integer, db.ForeignKey('t_weixin_official_acc.id'), comment='内部公众号id', nullable=False)
    article_title = db.Column(db.String(100), comment='文章标题')
    article_time = db.Column(db.DateTime(timezone=True), comment='文章发布时间')
    article_url = db.Column(db.String(500), comment='文章链接', nullable=False)
    article_key = db.Column(db.String(100), unique=True, comment='文章url-key')
    create_at = db.Column(db.DateTime(timezone=True), default=datetime.datetime.now, comment='创建时间')
    robot_id = db.Column(db.Integer, db.ForeignKey('t_robot_info.id'), comment='采集机器人ID')
